home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Python 1.1 / Modules / cryptmodule.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-06  |  543 b   |  37 lines  |  [TEXT/KAHL]

  1. /* cryptmodule.c - by Steve Majewski
  2.  */
  3.  
  4. #include "allobjects.h"
  5. #include "modsupport.h"
  6.  
  7. #include <sys/types.h>
  8.  
  9.  
  10. /* Module crypt */
  11.  
  12.  
  13. static object *crypt_crypt(self, args)
  14.     object *self, *args;
  15. {
  16.     char *word, *salt; 
  17.     extern char * crypt();
  18.  
  19.     struct passwd *p;
  20.     if (!getargs(args, "(ss)", &word, &salt)) {
  21.         return NULL;
  22.     }
  23.     return newstringobject( crypt( word, salt ) );
  24.  
  25. }
  26.  
  27. static struct methodlist crypt_methods[] = {
  28.     {"crypt",    crypt_crypt},
  29.     {NULL,        NULL}        /* sentinel */
  30. };
  31.  
  32. void
  33. initcrypt()
  34. {
  35.     initmodule("crypt", crypt_methods);
  36. }
  37.